POV-Ray : Newsgroups : povray.general : computed rotate in macros : Re: computed rotate in macros Server Time
12 Aug 2024 09:16:42 EDT (-0400)
  Re: computed rotate in macros  
From: Spider
Date: 28 Feb 1999 14:59:34
Message: <36D99EA7.F4436A97@bahnhof.se>
Another one in this discussion, I have several rotate and a translate, as this :


rotate <nX,0,0>
rotate <0,nY,0>
rotate <0,nZ,0>
translate <0,nL,0>

Now I wonder, is it possible to make this into only one rotate/translate, or,
even better into a matrix (I don't know the math, I only want to know if it is
possible, as so far.)
If it is possible to make only one matrix, can I combine two of them into only
one ?? (yes, macro :-)



"John M. Dlugosz" wrote:
> 
> Here is the situation:  A macro will create an object, and one of the
> parameters specifies the "up" vector of the desired object.  The macro will
> generate an object initially at the origin with a hard-coded "up" direction
> (say, +y) and then translate/rotate into the final location.  Translate is
> easy.  How about rotate?  In this case, I want to compute the arguments to
> 'rotate' so that what was +y now points paralell to the Up parameter.
> 
> The axis of rotation would be the cross product of the old and new up's.
> The angle can also be figured from this (I don't know the formula off hand,
> but it's not a big mystery).  BUT, POV wants a rotate command giving x,y,z
> component angles.  There isn't a form to rotate (the enclosing object) by a
> specific amount along a specified axis.
> 
> Anyone have the answer?
> 
> TIA,
> --John

-- 
//Spider 
( spi### [at] bahnhofse ) [ http://www.bahnhof.se/~spider/ ]
#declare life = rand(seed(42))*sqrt(-1);


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.